package classload;

import java.lang.reflect.Method;
import java.net.URL;

public class Main {
	private static URL lib_url = ClassLoader.getSystemClassLoader().getResource("datas");

	public static void main(String[] args) {
		
		try {
			MyClassLoader classLoader = new MyClassLoader(new URL[]{
//					new URL("C:\\Users\\Yichou\\Desktop\\work\\Child.jar")
					new URL(lib_url, "/Child.jar")
					}
			);
			
			Class<?> clazz = classLoader.loadClass("classload.Child");
			
			Object object = clazz.newInstance();
			Method method = clazz.getDeclaredMethod("c", (Class<?>[])null);
			method.setAccessible(true);
			method.invoke(object, (Object[])null);

			Method methoda = clazz.getDeclaredMethod("a", (Class<?>[])null);
			methoda.setAccessible(true);
			methoda.invoke(object, (Object[])null);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
